//
//  HYCTourPalPushCell.m
//  FamilyTravel
//
//  Created by dllo on 15/10/29.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "HYCTourPalPushCell.h"
#import "HYCHeadDocument.h"
#define WIDTH self.contentView.frame.size.width
#define HEIFGT self.contentView.frame.size.height
@implementation HYCTourPalPushCell
- (void)dealloc {
    [_timeLabel release];
    [_label release];
    [_tuImageView release];
    
    [super dealloc];
    
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCell];
    }
    return self;
}
- (void)creatCell {
    self.tuImageView = [[UIImageView alloc] init];
    [_tuImageView release];
    [self.contentView addSubview:self.tuImageView];
//    self.tuImageView.backgroundColor = [UIColor redColor];
    
    self.label = [[UILabel alloc] init];
    // 自适应高度
    self.label.numberOfLines = 0;
    [self.label sizeToFit];
    [_label release];
    [self.contentView addSubview:self.label];
    self.label.font = [UIFont systemFontOfSize:12];
    
    self.timeLabel = [[UILabel alloc] init];
    [_timeLabel release];
    [self.contentView addSubview:self.timeLabel];
     self.timeLabel.font = [UIFont systemFontOfSize:12];
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.tuImageView.frame = CGRectMake(WIDTH / (WIDTH / 10), 0, WIDTH - 20, HEIFGT / (HEIFGT / 200));
    
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:12], NSFontAttributeName, nil];
    
    CGRect rect = [self.label.text boundingRectWithSize:CGSizeMake(WIDTH, 10000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    // 设置mylabel的尺寸
    self.label.frame = CGRectMake(WIDTH / (WIDTH / 15), self.tuImageView.frame.size.height + 5, WIDTH - 30, rect.size.height);
   
    self.timeLabel.frame = CGRectMake(WIDTH / (WIDTH / 15), rect.size.height + 205, WIDTH / 2, 22);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
